import React from "react";

const withHoc=(WrappedComponent)=>{
    return class extends React.Component{
        state={
            count:10
        }

        componentDidMount(){
            console.log("页面挂载后");
            console.log(this.props);
        }
        render(){
            return (
                <WrappedComponent {...this.props} {...this.state} changeCount={this.changeCount} />
            )
        }

        changeCount=()=>{
            this.setState({
                count:this.state.count+1
            })
        }
    }
}

export default withHoc